<%-- 
    Document   : profil
    Created on : 16 avr. 2011, 14:58:41
    Author     : Jeremy Romano
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="../include/header.jsp" %>

<div id="main">
    <div id="container">
        <div id="content">
            <div id="registerDiv">
                <form id="modifForm" name="modifForm" method="post" action="ProfilServlet">
                    <input type="hidden" name="action" value="modification"/>
                    <label class="form-label">Login</label> <input value="${login}" name="login" id="login" type="text" class="required" size="25" />
                    <label class="form-label">Email</label> <input value="${email}" name="mail" type="text" class="required email" size="25" />
                    <label class="form-label">Nouveau Mot de passe</label> <input name="pwd" id="pwd" type="password" size="25" />
                    <label class="form-label">Re Nouveau mot de passe</label> <input name="pwd2" id="pwd2" type="password" size="25" />
                    <br/><br/>
                    <input name="inscription" type="submit" value="Modifier" />
                </form>
            </div>
            <script type="text/javascript">
                $("#login").keyup(function() {
                    $.get("./LoginServlet?action=existLogin&login="+$("#login").val(),
                    function(data){
                        if(data["exist"] == "true")
                        {
                            $("#login").removeClass("valid");
                            $("#login").addClass("error");
                        }
                        else
                        {
                            $("#login").removeClass("error");
                            $("#login").addClass("valid");
                        }
                    },
                "json"
            );
            });
            $("#login").blur(function(){
                var t = $("#login").val();
                if(t == "")
                {
                    $("#login").removeClass("valid");
                    $("#login").addClass("error");
                }
            });

            $("#pwd2").keyup(function() {
                if( $("#pwd").val() != $("#pwd2").val() )
                {
                    $("#pwd2").removeClass("valid");
                    $("#pwd2").addClass("error");
                }
                else
                {
                    $("#pwd2").removeClass("error");
                    $("#pwd2").addClass("valid");
                }
            });

            $("#pwd2").blur(function(){
                var t = $("#pwd2").val();
                if(t == "")
                {
                    $("#pwd2").removeClass("valid");
                    $("#pwd2").addClass("error");
                }
            });

            </script>
        </div><!-- #content -->
    </div><!-- #container -->
</div><!-- #main -->

<%@ include file="../include/footer.jsp" %>
